<?php

namespace App\Http\Controllers;

use Request;
use App\Helpers\ResponseHelper;
use App\Helpers\ValidateHelper;
use Illuminate\Routing\Controller;
use App\Exceptions\ValidationException;

class BaseController extends Controller
{
    use ResponseHelper;


    protected function validationParameter(array $rules = [], $message = [], $field = [])
    {

        $validate = new ValidateHelper($rules, $message, $field);
        $result = $validate->check(Request::all());

        if (!$result) {
            throw new ValidationException($validate->getError());

        }
        return $validate->getParams();
    }

}
